home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / Jotto2 src / Jotto ][ ƒ / Jotto code ƒ / jotto endgame.c < prev    next >
Text File  |  1993-12-11  |  2KB  |  73 lines

  1. /**********************************************************************\
  2.  
  3. File:        jotto endgame.c
  4.  
  5. Purpose:    This module handles the win-game and lose-game sequences.
  6.  
  7.  
  8. Jotto ][ -=- a simple word game, revisited
  9. Copyright (C) 1993 Mark Pilgrim
  10.  
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15.  
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with this program in a file named "GNU General Public License".
  23. If not, write to the Free Software Foundation, 675 Mass Ave,
  24. Cambridge, MA 02139, USA.
  25.  
  26. \**********************************************************************/
  27.  
  28. #include "jotto globals.h"
  29. #include "jotto endgame.h"
  30. #include "jotto graphics.h"
  31. #include "msg environment.h"
  32. #include "msg menus.h"
  33. #include "msg sounds.h"
  34. #include "msg dialogs.h"
  35. #include "msg graphics.h"
  36. #include "util.h"
  37.  
  38. Boolean            gIsEndGame;
  39.  
  40. void WinGame(void)
  41. {
  42.     
  43.     HighlightChar();
  44.     gIsEndGame=TRUE;
  45.     UpdateBoard();
  46.     gIsEndGame=FALSE;
  47.     DoSound(sound_wingame);
  48.     while (!Button());
  49.     while (Button());
  50.     FlushEvents(mDownMask+mUpMask+keyDownMask+keyUpMask+autoKeyMask, 0);
  51.     gInProgress=FALSE;
  52.     UpdateBoard();
  53.     AdjustMenus();
  54. }
  55.  
  56. void LoseGame(void)
  57. {
  58.     Str255            tempStr;
  59.     
  60.     HighlightChar();
  61.     DoSound(sound_losegame);
  62.     PositionDialog('ALRT', loseAlert);
  63.     Mymemcpy((Ptr)gHumanWord[gNumTries], gComputerWord, gNumLetters);
  64.     Mymemcpy((Ptr)((long)tempStr+1), (Ptr)gComputerWord, gNumLetters);
  65.     tempStr[0]=gNumLetters;
  66.     ParamText(tempStr,"\p","\p","\p");
  67.     Alert(loseAlert, 0L);
  68.     gInProgress=FALSE;
  69.     UpdateBoard();
  70.     AdjustMenus();
  71.     DrawMenuBar();
  72. }
  73.